<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:apabb="http://apabb.org.br/jsf"
	template="../template/template.xhtml">

	<ui:define name="nucleoBase">
		<h:form id="formBem">

			<div style="position: relative; left: 11px; font-size: 120%;">
				<h2>Manter Patrimonio</h2>
			</div>
			<hr size="3" style="left: 3px; background-color: #000080;" />


			<div id="pesquisaBem">

				<h:messages errorClass="erro" infoClass="info" showSummary="true" />

				<br />
				<fieldset styleClass="form"
					style="background-color: rgb(240, 250, 255)">

					<h:panelGrid columns="2" width="34%">
						
						<h:column>
							<h:outputLabel for="tipo_pat" value="Tipo: " />
						</h:column>
						<h:column>
							<h:selectOneMenu styleClass="inputContrast" name="tipo_pat"
								id="tipo_pat"
								value="#{patrimonioView.patrimonioPesquisa.tipoPatrimonio}" label="Tipo">
								<f:selectItem itemLabel="- Selecione -"/>
								<f:selectItems value="#{patrimonioView.listaTipoPatrimonio}" />
							</h:selectOneMenu>
						</h:column>
						
						<h:column>
							<h:outputLabel for="codigo" value="Patrimonio: " />
						</h:column>

						<h:column>
							<h:inputText styleClass="inputContrast"
								value="#{patrimonioView.patrimonioPesquisa.codigoPatrimonio}" name="codigo"
								id="codigo" type="text" size="10" maxlength="10"></h:inputText>
						</h:column>

						<h:column>
							<h:outputLabel for="nome" value="Modelo: " />
						</h:column>

						<h:column>
							<h:inputText styleClass="inputContrast"
								value="#{patrimonioView.patrimonioPesquisa.nomePatrimonio}" name="nome"
								id="nome" type="text" size="10" maxlength="10"></h:inputText>
						</h:column>
					</h:panelGrid>


					<br />

					<table border="1" width="35%" align="left">
						<tr>
							<td><h:commandButton action="#{patrimonioView.pesquisar}"
									value="  Pesquisar  "></h:commandButton></td>
							<td><a4j:commandButton action="#{patrimonioView.iniciar}"
									immediate="true" value="   Limpar   " render="formBem" /></td>
							<td><h:commandButton action="#{patrimonioView.novo}"
									value="    Novo    "></h:commandButton></td>
						</tr>

					</table>

				</fieldset>

				<br />

				<a4j:outputPanel id="outPutPanelListaBem">

					<fieldset>

						<div style="overflow: auto;">
							<div align="center">
								<h:outputText
									rendered="#{patrimonioView.exibeMsgNenhumRegistroEncontrado}"
									value="Nenhum registro encontrado." />
							</div>
							<h:dataTable id="TabelaProgramas"
								rendered="#{not empty patrimonioView.listaPatrimonio}"
								value="#{patrimonioView.listaPatrimonio}" var="patrimonio" width="100%"
								headerClass="tbhead">
								<h:column>
									<f:facet name="header">
										<h:outputText value="Patrimonio" />
									</f:facet>

									<div align="center">
										<h:commandLink action="#{patrimonioView.detalhar}"
											value="#{patrimonio.codigoPatrimonio}">
											<f:setPropertyActionListener target="#{patrimonioView.patrimonio}"
												value="#{patrimonio}" />
										</h:commandLink>
									</div>
								</h:column>

								<h:column>
										<f:facet name="header">
											<h:outputText value="Modelo" />
										</f:facet>
									<div align="center">
										#{patrimonio.nomePatrimonio}
									</div>
								</h:column>


								<h:column>
										<f:facet name="header">
											<h:outputText value="Tipo" />
										</f:facet>
									<div align="center">
										<h:outputText value="#{patrimonio.descTipoPatrimonio}" />
									</div>
								</h:column>
								
								<h:column>
										<f:facet name="header">
											<h:outputText value="Setor" />
										</f:facet>
									<div align="center">
										<h:outputText value="#{patrimonio.setor.nomeSetor}" />
									</div>
								</h:column>

								<h:column>
									<f:facet name="header">
										<h:outputText value="Alterar" />
									</f:facet>

									<div align="center">
										<h:commandLink action="#{patrimonioView.editar}">
											<h:graphicImage value="" alt="Alterar"
												url="../images/editar.jpg" height="20px" width="20px" />
											<f:setPropertyActionListener target="#{patrimonioView.patrimonio}"
												value="#{patrimonio}" />
										</h:commandLink>
									</div>

								</h:column>
								<h:column>
									<f:facet name="header">
										<h:outputText value="Excluir" />
									</f:facet>

									<div align="center">
										<a4j:commandLink action="#{patrimonioView.popupExcluir}">
											<h:graphicImage value="" alt="Excluir"
												url="../images/excluir.jpg" height="20px" width="20px" />
											<f:setPropertyActionListener target="#{patrimonioView.patrimonio}"
												value="#{patrimonio}" />
										</a4j:commandLink>
									</div>
								</h:column>
							</h:dataTable>

						</div>

					</fieldset>

				</a4j:outputPanel>


			</div>
			<apabb:popupConfirmacao componentView="#{patrimonioView}"
				form="formBem" />
		</h:form>

	</ui:define>
</ui:composition>
